import { Exclude } from 'class-transformer';
import { AppBaseEntity } from 'src/shared/database/baseEntity';
import { Column, Entity } from 'typeorm';

@Entity({
  name: 'users',
  orderBy: {
    createdAt: 'DESC',
  },
  comment: '用户表',
})
export class User extends AppBaseEntity {
  @Column({
    comment: '微信openId',
    name: 'wechat_open_id',
    default: '',
  })
  wechatOpenId: string;

  @Column({
    comment: '手机号',
    name: 'phone',
    unique: true,
  })
  phone: string;

  @Exclude()
  @Column({
    comment: '密码',
  })
  password: string;

  @Exclude()
  @Column({
    name: 'is_frozen',
    comment: '是否冻结',
    default: false,
  })
  isFrozen: boolean;

  @Exclude()
  @Column({
    comment: '是否超管',
    name: 'is_admin',
    default: false,
  })
  isAdmin: boolean;
}
